package com.qiangqiang.controller;

import com.qiangqiang.dto.BanDTO;
import com.qiangqiang.entity.Dormitory;
import com.qiangqiang.service.BanService;
import com.qiangqiang.service.DormitoryService;
import com.qiangqiang.util.ResultVOUtil;
import com.qiangqiang.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by q on 2018/2/20.
 */
@RestController
@RequestMapping("/dormitory")
public class DormitoryController {
    
    @Autowired
    private DormitoryService dormitoryService;


    @PostMapping("/update")
    public ResultVO<Dormitory> addOrUpdateDormitory(Dormitory dormitory){
        return ResultVOUtil.success(dormitoryService.addOrUpdateDormitory(dormitory));
    }

    @PostMapping("/delete")
    public ResultVO deleteDormitory(@RequestParam("id") String id){
        dormitoryService.deleteDormitory(id);
        return ResultVOUtil.success();

    }

    @PostMapping("/queryScore")
    public ResultVO<BigDecimal> queryScore(@RequestParam("id") String id){
        return ResultVOUtil.success(dormitoryService.queryScore(id));
    }

    /**
     * Created by q on 2018/2/20.
     */

}
